package com.ruoyi.system.service.impl;

import com.ruoyi.common.core.domain.entity.GarbageRecordDetail;
import com.ruoyi.system.mapper.GarbageRecordDetailMapper;
import com.ruoyi.system.service.GarbageRecordDetailService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * @Author: ruohao
 * @Date: 2023/9/3
 **/
@Service
public class GarbageRecordDetailServiceImpl implements GarbageRecordDetailService {
    @Resource
    private GarbageRecordDetailMapper garbageRecordDetailMapper;

    @Override
    public List<GarbageRecordDetail> selectList(GarbageRecordDetail garbageRecordDetail) {
        return garbageRecordDetailMapper.selectList(garbageRecordDetail);
    }

    @Override
    public List<GarbageRecordDetail> selectAll(GarbageRecordDetail garbageRecordDetail) {
        return garbageRecordDetailMapper.selectAll(garbageRecordDetail);
    }

    @Override
    public List<GarbageRecordDetail> selectToday(GarbageRecordDetail garbageRecordDetail) {
        return garbageRecordDetailMapper.selectToday(garbageRecordDetail);
    }

    @Override
    public GarbageRecordDetail selectById(Long id) {
        return garbageRecordDetailMapper.selectById(id);
    }

    @Override
    public List<GarbageRecordDetail> selectByRecordId(Long id) {
        return garbageRecordDetailMapper.selectByRecordId(id);
    }

    @Override
    public Boolean create(GarbageRecordDetail garbageRecordDetail) {
        return garbageRecordDetailMapper.insert(garbageRecordDetail) == 1;
    }

    @Override
    public Boolean update(GarbageRecordDetail garbageRecordDetail) {
        return garbageRecordDetailMapper.update(garbageRecordDetail) == 1;
    }

    @Override
    public Boolean deleteById(Long id) {
        return garbageRecordDetailMapper.deleteById(id) == 1;
    }

    @Override
    public Integer selectSumByLocationAndTime(String startTime, String endTime, Long garbageTypeId,
                                              String location) {
        return garbageRecordDetailMapper.selectSumByLocationAndTime(startTime, endTime, garbageTypeId, location);
    }
}
